package com.xiaxiang.xiawan.share;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.third.login.ThirdLoginPlatform;
import com.third.share.ThirdShareOperatorBase;
import com.third.share.umeng.sina.USinaThirdShare;
import com.third.share.umeng.tencent.UQQhirdShare;
import com.third.share.umeng.tencent.UWeiXinShare;
import com.third.share.view.ThirdShareItem;

/**
 * Created by Administrator on 2017-11-08.
 */

 class XXShareOperator extends ThirdShareOperatorBase {
    public XXShareOperator(Context context, View mainView) {
        super(context, mainView);
    }

    public void onCreate(Bundle bundle){
        super.onCreate(bundle);
      //  tvWechatShare.setImagePic(mSelectPicIdList[0]);
    }
    protected void initWeiXin(){
        if(mWeiXinShare == null){
            mWeiXinShare = new UWeiXinShare((Activity)mContext);
        }
    }

    protected void initQQ(){
        if(mQQShare == null){
            mQQShare = new UQQhirdShare((Activity)mContext);
        }
    }

    protected void initSina(){
        if(mSinaShare == null){
            mSinaShare = new USinaThirdShare((Activity)mContext);
        }
    }
    @Override
    protected void shareOperator(ThirdLoginPlatform platform) {
        Log.e("share"," mShareData is  "+mShareData);
        if(mShareData != null){
            mShareData.mThirdSharePlatform = platform;
        }
        switch (platform){
            case QQ:
                initQQ();
                mQQShare.thirdShare(mShareData);
                break;
            case WEIXIN:
                initWeiXin();
                mWeiXinShare.thirdShare(mShareData);
                break;
            case WEIXIN_CIRCLE:
                initWeiXin();
                mWeiXinShare.thirdShare(mShareData);
                break;
            case QZONE:
                initQQ();
                mQQShare.thirdShare(mShareData);
                break;
            case SINA:
                initSina();
                mSinaShare.thirdShare(mShareData);
                break;
        }
    }
}
